﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace WebSiteBuilder
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void DropDownListWebPartMenu_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (DropDownListWebPartMenu.SelectedIndex)
            {
                case 0:
                    WebPartManagerMain.DisplayMode = WebPartManager.BrowseDisplayMode;
                    break;
                case 1:
                    WebPartManagerMain.DisplayMode = WebPartManager.DesignDisplayMode;
                    break;
                case 2:

                    WebPartManagerMain.DisplayMode = WebPartManager.EditDisplayMode;

                    foreach (var part in WebPartManagerMain.WebParts.Cast<WebPart>())
                    {
                        part.Load += (sender2, e2) =>
                        {

                        };
                    }

                    break;


                case 3:
                    WebPartManagerMain.DisplayMode = WebPartManager.CatalogDisplayMode;
                    break;
                default:
                    WebPartManagerMain.DisplayMode = WebPartManager.BrowseDisplayMode;
                    break;
            }
        }
    }
}